<?php
/**
 * 描述
 * Created by Paco
 * Date: 2019/1/24 Time: 10:31
 */

namespace App\Http\Request\Product;


use App\Http\Request\Store;

class AttribueStore extends Store
{
    public function rules()
    {
        $method = strtoupper($this->method());
        $rules = [
            'name' => 'required',
            'is_spec' => 'required|integer',
            'is_required' => 'required|integer',
            'input_type' => 'required|integer',
            'group_number' => 'required|integer',
            'is_search' => 'required|integer',
            'status' => 'required',
            'sort' => 'required',
            'attr_values.*' => 'filled'
        ];
        if ($method == 'POST') {
            return $rules;
        } elseif ($method == 'PUT') {
            return ['attr_id' => 'required|integer', 'attr_values.*' => 'filled'];
        }
    }


    public function attributes()
    {
        return [
            'name' => '属性名称',
            'is_spec' => '是否为规则',
            'is_required' => '是否为必填项',
            'input_type' => '输入类型',
            'group_number' => '组编号',
            'group_name' => '组名',
            'is_search' => '是否为查找属性',
            'status' => '状态',
            'sort' => '排序',
        ];
    }

}